package tjx.Action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LoginRegistAction extends ActionSupport {
    private String username;
    private String password;
    private String tip;
    public String getTip() {
        return tip;
    }

    public void setTip(String tip) {
        this.tip = tip;
    }


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public String regist() throws Exception
    {
        ActionContext.getContext().getSession().put("user",getUsername());
        setTip("HAPPY,"+getUsername()+",YOU ARE GREAT SUCCESS");
        return SUCCESS;
    }
    @Override
    public String execute() throws Exception {
        if (getUsername().equals("crazy.org")&&getPassword().equals("leegang"))
        {
            ActionContext.getContext().getSession().put("user",getUsername());
            setTip("HELLO,"+getUsername()+",Login SUCCESS");
            return SUCCESS;
        }
        return ERROR;
    }
}
